package harima.collision.bodies;

import java.awt.geom.Line2D;


public class Body_Movement extends Body_Collision {

	public void move(Direction direction, float ammount) {
		
		ammount = Math.abs(ammount);
		
		this.x += direction.getMovementX() * ammount;
		this.y += direction.getMovementY() * ammount;
	}
	
	public boolean canMove(Direction direction, float ammount)
	{
		ammount = Math.abs(ammount);
		
		Line2D.Float side = direction.getSide(this);
		moveLine(direction, ammount, side);	
		return !checkLineCollision(side, this);
	}

	public void moveLine(Direction direction, float ammount, Line2D.Float side) {
		// TODO Auto-generated method stub
		side.x1 += direction.getMovementX() * ammount;
		side.x2 += direction.getMovementX() * ammount;
		side.y1 += direction.getMovementY() * ammount;
		side.y2 += direction.getMovementY() * ammount;

	}
}
